package com.lengxf.netty.command;

import com.lengxf.netty.command.impl.command_0.Command0;
import com.lengxf.netty.command.impl.command_1.Command1;
import com.lengxf.netty.enums.OperateTypeEnum;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class CommandFactory {

    private final Command0 command0;
    private final Command1 command1;

    /**
     * 获取实现
     */
    public Command getImpl(OperateTypeEnum operateTypeEnum) {
        return switch (operateTypeEnum) {
            case COMMAND_0 -> command0;
            case COMMAND_1 -> command1;
        };
    }

}
